//
//  ICTestCell1.m
//  iComeSDK_Example
//
//  Created by zhangrongwu on 2018/1/23.
//  Copyright © 2018年 zhangrongwu. All rights reserved.
//

#import "ICTestCell1.h"
#import "Masonry.h"

@implementation ICTestCell1

- (instancetype)initWithStyle:(UITableViewCellStyle)cell reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:cell reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor darkGrayColor];

        UIButton *btn = [[UIButton alloc] init];
        [btn setTitle:@"头像" forState:UIControlStateNormal];
        btn.backgroundColor = [UIColor cyanColor];
        [btn addTarget:self action:@selector(messageBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:btn];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [btn mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).offset(10);
            make.left.equalTo(self.contentView.mas_left).offset(10);
            make.height.mas_equalTo(50);
        }];
        
        UILabel *label = [[UILabel alloc] init];
        label.text = @"xxx";
        [self.contentView addSubview:label];
        
        [label mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(btn.mas_bottom).offset(10);
            make.left.mas_equalTo(self.contentView).offset(10);
            make.height.mas_equalTo(30);
        }];
        
        UILabel *desc = [[UILabel alloc] init];
        desc.text = @"描述消息";
        [self.contentView addSubview:desc];
        
        [desc mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(label.mas_bottom).offset(10);
            make.left.equalTo(label.mas_right).offset(10);
            make.height.mas_equalTo(30);
        }];
        
        UIImageView *imageV = [[UIImageView alloc] init];
        imageV.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:imageV];
       
        [imageV mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(desc.mas_bottom).offset(10);
            make.left.equalTo(desc.mas_right).offset(10);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(60);
        }];
        
        [self.bottomLine mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(imageV.mas_bottom);
            make.right.and.left.mas_equalTo(self.contentView);
            make.height.mas_equalTo(1);
            make.bottom.mas_equalTo(self.contentView.mas_bottom);
        }];
        
        self.bottomLine.backgroundColor = [UIColor redColor];
        self.bottomLine.alpha = 1;
    }
    return self;
}

- (void)messageBtnClick {
    NSLog(@"测试");
}

-(void)setData:(id)data {
    NSLog(@"%@", data);
}

@end
